feat(mcp): select library media and follow indexing progress in the MCP App - #152
Open
Haseeb-1698 wants to merge 1 commit into
Open
Conversation
…CP App The MCP App covered uploading and inspecting evidence. Two items from the issue's first useful version were missing: selecting a video that is already registered, and following indexing progress. Attach the existing app template to list_media and get_job_status, and add the two matching views to the widget. list_media pages through the library and records the chosen media in the model context; get_job_status renders stage, message and step counts, and re-polls itself using the job's own poll_after_seconds until the job is terminal. No new tools and no separate application backend: both views drive tools that already exist, and the reused media and job lifecycle stays the source of truth. Closes grayhatdevelopers#73.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Closes #73.
Summary
The MCP App already covered two of the four items in the issue's "first useful version": uploading (
create_media_upload) and inspecting evidence boards, keyframes and clips (present_job_evidence). This adds the other two — selecting a video that is already registered, and following indexing progress.Both are driven by tools that already exist, so there is no new tool and no separate application backend:
list_medianow carries the app template. The widget lists registered videos with state, duration, size and container, pages throughnext_cursor, and on selection writesselectedMediaIdviaui/update-model-contextandsetWidgetState, then confirms withget_media.get_job_statusnow carries it too. The widget rendersstage,messageandcurrent/totalwith a progress bar, offers a manual refresh, and re-polls itself using the job's ownpoll_after_secondswhileterminalis false, clearing its timer on every re-render.I used
get_job_statusrather thanget_jobbecause its own description recommends it for active work andJobSummaryis the compact record.Affected interfaces: two read-only tools gain
_metaonly; no signatures, arguments or return types change. The widget additions are new render paths dispatched after the existinguploadandevidencebranches, so current results render exactly as before. No compatibility or migration impact.Validation
Run on linux/amd64, Python 3.12, at
24b916a, afteruv sync --all-extras:ruff check .(0.16.6, whole repo)uv run --no-sync pytest -q tests/test_mcp.pyPYTHONPATH=. uv run --no-sync pytest -q(full suite)node --checkon the widget's extracted<script>The 7 failures are
chromadbRuntimeErrors fromchromadb/config.py:375intest_benchmarks.py,test_local_snapshots.pyandtest_storage_integration.py. They reproduce identically with this branch's two files stashed (7 failed, 32 passed on the clean tree), so they are pre-existing on this machine and unrelated to the change. The full suite also needsPYTHONPATH=.here or five packaging modules fail to importutils; that is likewise unchanged by this branch.Not exercised: I have not run the widget inside a real MCP host, so the new views are verified by unit tests, lint and JavaScript syntax only — not against an actual host's
ui/*message flow, and not against a live indexing job. Please treat the rendering as unproven at that boundary.I opened this rather than waiting on my comment in #73 so there is something concrete to react to. Happy to rework the scope, split it into library-selection and progress separately, or drop it if you have a different direction in mind.